package com.task.bean;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.task.util.StringUtil;

public class TaskRunBean  implements Serializable{

	private static final long serialVersionUID = 1L;

	//id
	private String id;
	
	//任务名称
	private String name;
    
	//参数
	private String param;
	
	//----------------start------------------------
	//IP端口
	private String registID;
	
	//任务注解名称
	private String registName;
	
	//任务执行方法
	private String registMethod;
	
	//端口IP
	private String registIPPort;
	
	//备注
	private String regsitPurpose;
	//----------------end---------------------------
	
	//备注
	private String purpose;
	
	//corn表达式
	private String corn;
	
	//插入时间
	private String insertDate;
	
	//更新时间
	private String updateDate;
	
	//状态
    private String status;

    //-------定时任务处理参数--------------------------
    private String startTime;
    private String jobName;  //任务名称
    private String jobGroup;  //任务分组 
    //----------------------------------
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getParam() {
		if(StringUtil.isNUll(this.param)) {
			return "";
		}else {
			return param;
		}
	}
	public void setParam(String param) {
		this.param = param;
	}

	public String getRegistID() {
		return registID;
	}

	public void setRegistID(String registID) {
		this.registID = registID;
	}

	public String getPurpose() {
		return purpose;
	}

	public void setPurpose(String purpose) {
		this.purpose = purpose;
	}

	public String getInsertDate() {
		return insertDate;
	}

	public void setInsertDate(String insertDate) {
		this.insertDate = insertDate;
	}

	public String getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(String updateDate) {
		this.updateDate = updateDate;
	}

	public String getStatus() {
		//如果为空默认状态
		if(StringUtil.isNUll(status)) {
			return "0";
		}
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getCorn() {
		return corn;
	}

	public void setCorn(String corn) {
		this.corn = corn;
	}

	public String getRegistName() {
		return registName;
	}

	public void setRegistName(String registName) {
		this.registName = registName;
	}

	public String getRegistMethod() {
		return registMethod;
	}

	public void setRegistMethod(String registMethod) {
		this.registMethod = registMethod;
	}

	public String getRegistIPPort() {
		return registIPPort;
	}

	public void setRegistIPPort(String registIPPort) {
		this.registIPPort = registIPPort;
	}

	public String getRegsitPurpose() {
		return regsitPurpose;
	}

	public void setRegsitPurpose(String regsitPurpose) {
		this.regsitPurpose = regsitPurpose;
	}

	public String getStartTime() {
		if(StringUtil.isNUll(this.startTime)) {
			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	    	return df.format(new Date());			
		}else {
			return startTime;
		}
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	public String getJobName() {
		if(StringUtil.isNUll(jobName)) {
			return this.name;
		}else {
			return jobName;
		}
	}

	public void setJobName(String jobName) {
		this.jobName = jobName;
	}

	public String getJobGroup() {
		if(StringUtil.isNUll(this.jobGroup)) {
		   return this.name;
		}else {
			return jobGroup;
		}
	}

	public void setJobGroup(String jobGroup) {
		this.jobGroup = jobGroup;
	}

	@Override
	public String toString() {
		return "TaskRunBean [id=" + id + ", name=" + name + ", param=" + param + ", registID=" + registID
				+ ", registName=" + registName + ", registMethod=" + registMethod + ", registIPPort=" + registIPPort
				+ ", regsitPurpose=" + regsitPurpose + ", purpose=" + purpose + ", corn=" + corn + ", insertDate="
				+ insertDate + ", updateDate=" + updateDate + ", status=" + status + ", startTime=" + startTime
				+ ", jobName=" + jobName + ", jobGroup=" + jobGroup + "]";
	}
}